# !/usr/bin python3
# encoding: utf-8 -*-
# @file : conftest.py
# @author : hailiang.ji
# @Time : 2023/10/24 8:10
import time
import pytest
import os
import logging
loggr = logging.getLogger(__name__)
@pytest.fixture(scope='session')
def real_song_test():
    shuju = {
        'cpu':[],
        'mem':[]
    }
    # log_path = real_operation['adb_path']
    # os.system('adb shell top -d 5 > ./log/test_log/top.log')
    # time.sleep(10)
    # os.system('adb pull /storage/emulated/hai//top.log .\log\\test_log')
    loggr.info('pull  log success')
    # os.mkdir('./aaa')
    with open(r'./log/test_log/top.log') as file:
        print('kai shi fenxi')
        files = file.readlines()
        for line in files:
            if 'com.cmcc.cmvide+' in  line:
                shuju['cpu'].append(float(line.split(" ")[-5]))
                shuju['mem'].append(float(line.split(" ")[-8]))
    yield shuju
    print('ending')